<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

//后台路由文件
require_once app_path('Http/Route').'/admin.php';

Route::get('/', function () {
    return view('welcome');
});

//get
Route::get('t1', function () {
    echo 'hello world';

    /*echo "<pre>";
    打印加载的文件
    print_r(get_included_files());*/
});

//post
Route::post('t1', function () {
    echo 'post';

    /*echo "<pre>";
    打印加载的文件
    print_r(get_included_files());*/
});

//any
Route::any('t2', function () {
    echo 'any';
});

//必选参数路由
Route::any('t3/{name}', function ($name) {
    echo $name;
});

//可选参数路由
Route::any('t3/{name?}', function ($name='186') {
    echo $name;
});

//参数限制
Route::any('t3/{name?}', function ($name='186') {
    echo $name;
})->where('name','[a-z]+');

//访问控制器
Route::get('t4/{num}','ArticleController@say');

//隐式控制器
Route::controller('t5','ArticleController');

//资源路由
Route::resource('art','ArticleController');
/* get
 * art          -> ArticleController@index
 * art/create   -> ArticleController@create
 * art/12       -> ArticleController@show
 * art/12/edit  -> ArticleController@edit
 *
 * post
 * art          -> ArticleController@store
 *
 * put/patch
 * art/12       -> ArticleController@update
 *
 * delete
 * art/12       -> ArticleController@destroy
 */

//登录注册路由
// 认证路由...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
// 注册路由...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

//首页路由
Route::get('/','Home\IndexController@index');
//商品列表页路由
Route::resource('cat','Home\CatController');

//图片上传路由
Route::resource('image','Home\ImageController');


